package com.hzit.pay.center.controller;

import com.hzit.pay.center.service.IRefundService;
import com.pay.center.common.req.RefundReq;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 退款接口
 */
@RestController
@RequestMapping("/refund")
public class RefundController {

    private Logger logger = LoggerFactory.getLogger(RefundController.class);

    @Autowired
    private IRefundService refundService;


    /**
     * 定义接口 请求参数，返回参数。
     * 记录退款申请：设计一张表。
     * 退款：同步,异步。 兼容同步和异步
     *
     */
    @RequestMapping(value = "/create",method = RequestMethod.POST)
    public void  create(@Validated @RequestBody RefundReq refundReq){
        //接口入口打印日志
        logger.info("#######接收到退款请求，请求参数：{}########",refundReq);

        refundService.refund(refundReq);

    }



}
